package main

import (
	"fmt"
)

var (
	coins = 50
	users = []string{
		"Matthew", "Sarah", "Augustus", "Heidi",
		"Emilie", "Peter", "Giana", "Adriano",
		"Aaron", "Elizabeth",
	}
	distribution = make(map[string]int, len(users))
)

// 名字含:
//   e/E 分 1 枚
//   i/I 分 2 枚
//   o/O 分 3 枚
//   u/U 分 4 枚
func dispatchCoin() (left int) {
	for _, user := range users {
		// user2 := strings.ToUpper(user)
		// if strings.Contains(user2, "U") {
		// 	coins = coins - 4
		// 	distribution[user] = 4
		// } else if strings.Contains(user2, "O") {
		// 	coins = coins - 3
		// 	distribution[user] = 3
		// } else if strings.Contains(user2, "I") {
		// 	coins = coins - 2
		// 	distribution[user] = 2
		// } else if strings.Contains(user2, "E") {
		// 	coins = coins - 1
		// 	distribution[user] = 1
		// }

		for _, c := range user {
			switch c {
			case 'u', 'U':
				coins -= 4
				distribution[user] += 4
			case 'i', 'I':
				coins -= 3
				distribution[user] += 3
			case 'o', 'O':
				coins -= 2
				distribution[user] += 2
			case 'e', 'E':
				coins--
				distribution[user]++
			}
		}
	}
	return left
}

func main() {
	left := dispatchCoin()
	fmt.Println("剩下：", left)
	fmt.Println("金币分配：", distribution)
}
